package flyweight;

import java.util.HashMap;

public class ShapFactory {
    private static final HashMap<String, Shape> cricleMap = new HashMap<>();

    public static Shape getCricle(String color) {
        Cricle circle = (Cricle)cricleMap.get(color);
        if (circle == null) {
            circle = new Cricle(color);
            cricleMap.put(color, circle);
            System.out.println("新创建了一个" + color + "的圆");
        }
        return circle;
    }
}
